package com.example.spring5.事务;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional //事务注解    Transactional事务注解详情
public class BankService{
    @Autowired
    BankDao bankDao;
    @Transactional
    public void accountMoney(Double range) {
        //张三 少 100
        bankDao.reduceMoney("张三",range);
        int a=10/0;
        //李四 多 100
        bankDao.plusMoney("李四",range);
    }

}